<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    
    import="java.util.List"
    import="pojo.Food"
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> ${curname }</title>

<style type="text/css">
    	.container{
    		width:1000px;
    		margin:0 auto;
    	}
    	.type-bar{
    		width:1000px;
    		height:40px;
    	}
    	.type-a{
	        text-decoration:none;
	        line-height: 50px;
	        color: #000000;
	        padding:5px 10px;
    	}
    	.type-active{
    		font-weight: bold;
    	}
    	.main-table{
    		width:1000px;
    	}
    	th{
    		padding:0 30px;
    	}
    	table{
    		text-align: center;
    		margin: 10px auto;
    	}
    	
    	td{
    	border-radius:20px 20px 20px 20px;
    	border:2px solid #000;
    	width:auto;
    	 height:auto; 
    	 margin:auto;
    	 background-color:#fff;
    	 padding:20px;
    	}
    	
    </style>
</head>
<body>
	<jsp:include page="common/bar.jsp"></jsp:include>
	<div class="container">
		
		<table>
			<%
			List<Food> foodList = (List<Food>)request.getAttribute("foodlist");
			
			if(foodList == null || foodList.isEmpty()){
				out.print("待上架..."); 
			}
			
			int cur = 0;
			//List<MItem> mlist = (List<MItem>)request.getSession().getAttribute("mlist");
			for(cur=0;cur<foodList.size();cur++){
				if(cur%4==0){
					out.print("<tr>");
				}
				Food item = foodList.get(cur);
				out.print("<td>");

				out.print("<div>");
				
				out.print("<img style=\"width:120px;height:120px;\" src=\""+ item.getImg() +"\" ></img>");
				out.print("<p>");
				out.print(item.getName());
				out.print("</p>");
				out.print("<p>");
				out.print("$"+item.getPrice());
				out.print("</p>");
				out.print("<p>");
				out.print("类型："+ item.getTypeName());
				out.print("</p>");
				out.print("</div>");
				out.print("</td>");
				
				if(cur%4==3){
					out.print("</tr>");
				}
			}
			%>	
		</table>
		
		
	</div>
</body>
</html>